import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from "path";
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  server: {
    port: 4000,
    open: true,
    host: 'localhost',
    //配置代理，实现跨域
    proxy:{
      "/api":{
        target:"http://192.168.110.49:8888",
        // target:"http://192.168.110.35:8888",
        changeOrigin:true,
        // rewrite:url =>url.replace(/^\/api/, '/api/')
        rewrite:url =>url.replace(/^\/api/, '')
      }
    }
  },
  resolve: {
    alias: [
      {
        find: "@",
        replacement: resolve(__dirname, "src")
      }
    ]
  }
})